package com.project.rule.service;

import com.alibaba.fastjson.JSON;
import com.project.dao.UserDao;
import com.project.entity.UserEntity;
import com.project.service.DubboUserService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.UUID;

@DubboService(version = "1.0.0")
public class UserDubboServiceImpl implements DubboUserService {

    @Resource
    private UserDao userDao;

    @Override
    public String get() {
        return JSON.toJSONString(userDao.selectAll());
    }

    @Override
    public Long insert(UserEntity userEntity) {
        userEntity.setId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
        return userDao.insert(userEntity);
    }


}
